<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="pret" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="gotoPage('/crm/sale/BusOpportunityUp?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
          <el-button @click="gotoPage('/crm/sale/CartogramBusOpportunity?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 商机统计 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="24">
                <el-form-item label="商机条形码" prop="">
                  {{pret.predict_barcode}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="主题" prop="predict_theme">
                  {{pret.predict_theme}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="客户" prop="predict_client">
                  {{pret.predict_client}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="月预计销售额" prop="predict_optno">
                  {{pret.predict_optno}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="关闭可能性" prop="reckon_clised">
                  {{pret.reckon_clised}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="提醒时间" prop="predict_remindate">
                  {{pret.predict_remindate}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="商机描述" prop="predict_des">
                  {{pret.predict_des}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="经理" prop="client_manager">
                  {{pret.client_manager}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-button @click="gotoPage('/crm/sale/CartogramBusAssemblyAdd?'+vueparams+'')" type='primary' size="mini">添加组件</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 组成 </span>
          </div>
          <el-table :data="part">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="gotoPage('&CMID2='+scope.row.part_id+''+vueparams+'')">查看明细</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="gotoPage('&CMID2='+scope.row.part_id+''+vueparams+'')">查看组成记录</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="gotoPage('&CMID2='+scope.row.part_id+''+vueparams+'')">修改</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_part('&CMID2='+scope.row.part_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="组件" prop="part_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('/crm/sale/CartogramBusAssemblyDet?CMID2='+scope.row.part_id+''+vueparams+'')" type='primary'>{{scope.row.part_des}}</el-link>
              </template>
            </el-table-column>
            <el-table-column label="最佳预计    CNY" prop="part_opt">
            </el-table-column>
            <el-table-column label="关闭可能性(%)" prop="part_clised">
            </el-table-column>
            <el-table-column label="估计关闭日期" prop="part_closedate">
              <template slot-scope="scope">
              </template>
            </el-table-column>
            <el-table-column label="猜测金额" prop="">
            </el-table-column>
            <el-table-column label="关闭日期" prop="">
            </el-table-column>
            <el-table-column label="当前状态" prop="">
            </el-table-column>
            <el-table-column label="分配人员" prop="part_person">
            </el-table-column>
          </el-table>
          <el-button @click="gotoPage('/crm/sale/BusOpportunityUp?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
          <el-button @click="gotoPage('/crm/sale/CartogramBusOpportunity?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'商机明细'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'BusOpportunityDet',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        pret: {
          predict_barcode: null,
          predict_theme: null,
          predict_client: null,
          predict_optno: null,
          reckon_clised: null,
          predict_remindate: null,
          predict_des: null,
          client_manager: null,
        },
        part: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "1BF69B6D830144DA817BDEE6290C9AEA",
        name: "商机管理",
        selected: "商机明细"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/PotentialAdmin/busOpportunityDet?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_part(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/PotentialAdmin/d_part?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
